/**
 * express.js 视图渲染（PUG）示例
 */

const express = require("express");

// 创建express应用
const app = express();

// express http服务端口
const port = 3001;

//定义视图路径
app.set("views","./views");
//指定视图渲染引擎
app.set("view engine","pug");

// http访问路径
app.get("/",function(req,res){
   res.render("10_index",{
    title:"Express支持Pug模板",
    message:"hello Express.js & Pug",
    dataList:["数据项1","数据项2","数据项3"]
    });
});

// 启动http服务
app.listen(port,function(){
    console.log(`myapp访问地址：http://127.0.0.1:${port}`)
})